package com.tour.sic.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @program: SIC
 * @description: 业务接口层
 * @author: team
 * @create: 2021-04-22 16:25:00
 */
@Configuration //标记这是配置
@EnableSwagger2 //启用Swagger
public class SwaggerConfig {
    //构建文档的基本信息
    public ApiInfo createApi(){
        return new ApiInfoBuilder().description("可以实现项目的接口在线浏览，同时可以对接口进行在线测试")
                .title("项目的接口文档").contact(new Contact("team","http://www.qfedu.com","xingfei_work@163.com"))
                .version("1.0").build();
    }
    @Bean //就是ioc创建实例 修饰方法 方法必须返回对象
    public Docket createDocket(){
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(createApi())
                .select().apis(RequestHandlerSelectors.basePackage("com.tour.sic.controller")).build();
    }
}